package com.itheima.date.jdk8DateDemo;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.Month;

public class JDK8DateDemo3 {
    public static void main(String[] args) {
        LocalDateTime localDateTime = LocalDateTime.of(2020, 11, 11, 11, 11, 20);
        int year = localDateTime.getYear();
        System.out.println(year);

        int month = localDateTime.getMonthValue();
        System.out.println(month);

        int day = localDateTime.getDayOfMonth();
        System.out.println(day);

        Month monthEnum = localDateTime.getMonth();
        System.out.println(monthEnum);

        int dayOfYear = localDateTime.getDayOfYear();
        System.out.println("这是一年中的第 " +dayOfYear + " 天");

        DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
        System.out.println("星期为 " +dayOfWeek);

        int minute = localDateTime.getMinute();
        int hour = localDateTime.getHour();
        System.out.println(hour + ":" + minute);
    }
}
